/*
 * QCalDetailsWidget.cpp
 *
 *  Created on: Aug 30, 2010
 *      Author: deroy2
 */
#include <QStackedWidget>
#include <QSettings>
#include <QWidget>
#include <QLineEdit>
#include <QPushButton>
#include <QVBoxLayout>
#include <QMessageBox>
#include <QTextEdit>
#include "QCalDetailsWidget.h"
QCalDetailsWidget::QCalDetailsWidget(QStackedWidget* stackedWid,eventDetail& event, QWidget *parent)
   // : QBaseWidget(stackedWidget,parent)
	{
	QMessageBox msgBoxErr;
	 msgBoxErr.setText("QDetailsWidget");
	 msgBoxErr.exec();
	stackedWidget=stackedWid;
	//rWidget = new QWidget();
	QString strTitle;
	QString strContent;
	QString strWhere;
	QString strWhenEnd;
	QString strWhenStart;
	strTitle.append(event.title);
	strContent.append(event.content);
	strWhere.append(event.location);
	strWhenEnd.append(event.endTime);
	strWhenStart.append(event.startTime);
	QTextEdit* text= new QTextEdit(this);
	text->clear();
	text->append("======Title======");
	text->append(strTitle);
	text->append("");
	text->append("======Content======");
	text->append(strContent);
	text->append("");
	text->append("======Place======");
	text->append(strWhere);
	text->append("");
	text->append("======StartTime======");
	text->append(strWhenStart);
	text->append("");
	text->append("======EndTime======");
	text->append(strWhenEnd);
	text->append("");
	text->setReadOnly(true);
	QPushButton* dnldButton = new QPushButton("&NextPage", this);
	QPushButton* nxtButton = new QPushButton("&Prev Page", this);
	QObject::connect(nxtButton, SIGNAL(clicked()),
			                  this, SLOT(PrevPage()));
	QVBoxLayout* layout = new QVBoxLayout();
	layout->addWidget(text);
	layout->addWidget(dnldButton);
	layout->addWidget(nxtButton);
	this->setLayout(layout);
//	this->repaint();
//	this->show();
	
	//pWidget->showMaximized();
	
//	stackedWidget->addWidget(this);
//	this->showMaximized();
	}

QCalDetailsWidget::~QCalDetailsWidget()
    {
  //  delete menuBar;
  //  delete upldr;
    }

//void QDetailsWidget::createMenus()
//    {
//    /*// Create menubar for this widget
//    // We sets these menu items into into QMainWindow menu when this widget is active
//    menuBar = new QMenuBar();
//
//    menuAction = new QAction("Hello QMyWidget2",menuBar);
//    menuBar->addAction(menuAction);
//    connect(menuAction, SIGNAL(triggered()),this, SLOT(hello()));*/
//    }
//
//QMenuBar* QDetailsWidget::MenuBar() const
//    {
//	//  return menuBar;
//    }
void QCalDetailsWidget::NxtPage()
	{
	
	}
void QCalDetailsWidget::PrevPage()
	{
	//stackedWidget->currentWidget()->setHidden(true);
	stackedWidget->removeWidget(this);//todo:delete newwidget
	stackedWidget->setCurrentIndex(0);
	stackedWidget->show();
	
//	//QMyWidget2* newWidget = new QMyWidget2(stackedWidget,eventArray,this);
//	QGoogleCalendar* newWidget=new QGoogleCalendar(this);
//	stackedWidget->removeWidget(this);
//	activateNewWidget(newWidget);
//	stackedWidget->addWidget(newWidget);
//	newWidget->show();
	}
